package com.hnkywl.sts.entity.sfgl;

import com.hnkywl.sts.entity.BaseEntity;
import com.hnkywl.sts.entity.base.Sjzdz;
import com.hnkywl.sts.entity.cggl.Jsd;
import com.hnkywl.sts.entity.htgl.Ht;
import com.hnkywl.sts.entity.organ.*;
import com.hnkywl.sts.entity.sys.Yg;
import com.hnkywl.sts.entity.xsgl.Xsd;
import com.hnkywl.sts.entity.zjgl.Pj;
import com.hnkywl.sts.entity.zjgl.Xyz;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.annotations.Where;

import javax.persistence.*;
import java.util.Date;
import java.util.List;

/**
 * 收付款
 * Created with IntelliJ IDEA.
 * User: jerry
 * Date: 13-3-3
 * Time: 下午10:22
 * To change this template use File | Settings | File Templates.
 */
@Entity
@Table(name = "T_BIZ_SFK")
@Where(clause = "deleted!='1'")
public class Sfk extends BaseEntity {
    @Id
    @SequenceGenerator(name = "seqSfk", allocationSize = 1, sequenceName = "SEQ_BIZ_SFK")
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seqSfk")
    private Long id;
    /**
     * 编码
     */
    private String bm;

    /**
     * 收付款类型：1 供应付款 2 销售退款 3 销售收款  4 供应退款
     */
    private Integer sfklx;

    /**
     * 收付款时间
     */
    private Date sfkrq;


    /**
     * 审核状态
     * zt   已保存 ybc  已入账  yrz   已审核  ysh   已提交  ytj  已退回 yth 已调整 ytz
     */
    private String zt;

    /**
     * 是否解锁保证金 1 ： 已锁定 null ：已保存、已解锁、未使用
     */
    private Integer sfJsBzj;


    /**
     * 收款方式
     */
    @ManyToOne
    @JoinColumn(name = "KXYT_SJZDZ_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Sjzdz kxyt;

    /**
     * 款项使用
     */
    @ManyToOne
    @JoinColumn(name = "KXSY_SJZDZ_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Sjzdz kxsy;

    /**
     * 票据类型
     */
    @ManyToOne
    @JoinColumn(name = "PJLX_SJZDZ_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Sjzdz pjlx;

    /**
     * 关联单位
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "GLDW_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Gsjg gldw;

    /**
     * 关联单位开户行
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "GLKHH_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Khh glkhh;

    /**
     * 内部公司开户行
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "NBKHH_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Khh nbkhh;


    /**
     * 回款类型
     */
    @ManyToOne
    @JoinColumn(name = "HKLX_SJZDZ_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Sjzdz hklx;

    /**
     * 合同
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "HT_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Ht ht;


    /**
     * 结算单
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "JSD_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Jsd jsd;

    /**
     * 款项类型 1：预付款 2：应付款  3：预收款  4：应收款
     */
    private Integer kxlx;

    /**
     * 收付金额
     */
    private Double sfje;

    /**
     * 余额
     */
    private Double ye;

    /**
     * 备注
     */
    private String bz;

    /**
     * 申报公司
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "SBGS_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Gsjg sbgs;

    /**
     * 申报部门
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "SBBM_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Nbbm sbbm;

    /**
     * 考核公司
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "KHGS_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Nbgs khgs;

    /**
     * 考核部门
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "KHBM_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Nbbm khbm;
    /**
     * 申报人
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "SBR_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Yg sbr;

    /**
     * 入账人
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "RZR_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Yg rzr;

    /**
     * 审核人
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "SHR_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Yg shr;

    /**
     * 付款关联的应付票据
     */
    @OneToMany(fetch = FetchType.LAZY, targetEntity = Pj.class, mappedBy = "sfk")
    @NotFound(action = NotFoundAction.IGNORE)
    private List<Pj> pjList;

    /**
     * 收款关联的应收票据
     */
    @OneToMany(fetch = FetchType.LAZY, targetEntity = Pj.class, mappedBy = "sk")
    @NotFound(action = NotFoundAction.IGNORE)
    private List<Pj> yspjList;


    /**
     * 信用证
     */
    @OneToMany(fetch = FetchType.LAZY, targetEntity = Xyz.class, mappedBy = "sfk")
    @NotFound(action = NotFoundAction.IGNORE)
    private List<Xyz> xyzList;


    @OneToMany(fetch = FetchType.LAZY, targetEntity = Sfkmx.class, mappedBy = "fksh")
    @NotFound(action = NotFoundAction.IGNORE)
    private List<Sfkmx> sfkmxList;

    /**
     * 内部划转收付款
     */
    @OneToMany(fetch = FetchType.LAZY, targetEntity = Sfk.class, mappedBy = "nbhzsfk")
    @NotFound(action = NotFoundAction.IGNORE)
    private List<Sfk> nbhzSfkList;

    //内部划转收付款
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "NBHZSFK_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Sfk nbhzsfk;


    /**
     * 会计年
     */
    @Column(name = "jiuqi_acctyear")
    private Integer acctyear;
    /**
     * 生成久其凭证时提供的ID
     */
    @Column(name = "jiuqi_uuid")
    private String uuid;
    /**
     * 久其返回的凭证ID
     */
    @Column(name = "jiuqi_voucher_id")
    private String voucherId;
    /**
     * 久其返回的凭证号
     */
    @Column(name = "jiuqi_voucher_num")
    private Integer voucherNum;
    /**
     * “久其插入标示”代码   1=未导入,2=导入开始,3=导入成功
     */
    @Column(name = "jiuqi_insert_flag")
    private Integer insertFlag = 1;
    /**
     * "久其删除标示”代码   1=未删除,2=删除开始,3=删除成功
     */
    @Column(name = "jiuqi_delete_flag")
    private Integer deleteFlag = 1;
    /**
     * 操作状态
     */
    @Transient
    private String czzt;
    /**
     * 特批付款  ftpfk非特批付款  tpfk  特批付款
     */
    private String sftpfy = "ftpfk";

    //审核日期
    private Date shrq;

    //初始化字段  凡是从老系统导入的为初始化字段  置为 1  其他为非初始化
    private String csh;


    //是否五四一付款
    private Integer sfwsyfk;

    /**
     * 关联流程实体
     */
    @Basic
    @Column(name = "LC_ID")
    private String processInstanceId;

    /**
     * 是否其他付款 0 不是其他付款  1 其他付款
     */
    private Integer qtfk;

    /**
     * 是否自动划转 0 不是自动划转 1 自动划转
     */
    private Integer zdhz = 0;


    /**
     * 借方二级账户
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "JFEJZH_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Ejzh jfejzh;


    /**
     * 贷方二级账户
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "DFEJZH_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Ejzh dfejzh;

    /**
     * 往来帐类型  0  内部  1 外部
     */
    private Integer wlzlx;

    /**
     * 导入日期
     */
    private Date drrq;

    /**
     * 是否保证金  0  非保证金  1 是保证金
     */
    private Integer sfBzj = 0;

    /**
     * 付款方式  现汇  承兑
     */
    @ManyToOne
    @JoinColumn(name = "FKFS_SJZDZ_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Sjzdz fkfs;

    //承兑开始时间
    private Date startDate;

    //承兑结束时间
    private Date endDate;

    // 客户付款时间
    private Date khfksj;

    //免息天数
    private Integer mxts;

    //贴息率
    private Double txl;

    //贴息
    private Double tx;

    //贴息余额
    private Double txye;

    // 计算天数
    private Long jstx;

    // 票据号码
    private String pjhm;

    // 是否划转 0:否，1：是
    private String sfhz;

    //判断收款是否被出库单挂上
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "XSD_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Xsd xsd;


    /**
     * 款项类型 0：非计划现货  1：物流金融
     */
    private Integer fplx;

    /**
     * 是否抛账 0：否  1：是 2：已抛账
     */
    private Integer sfpz;

    /**
     * 划转时间
     */
    private Date hzsj;

    /**
     * 划转人
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "HZR_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Yg hzr;

    /**
     * 贴息情况 0：没有计算贴息，1：计算贴息
     */
    private String sfjstx;

    public Integer getSfJsBzj() {
        return sfJsBzj;
    }

    public void setSfJsBzj(Integer sfJsBzj) {
        this.sfJsBzj = sfJsBzj;
    }

    public Integer getFplx() {
        return fplx;
    }

    public void setFplx(Integer fplx) {
        this.fplx = fplx;
    }

    public Xsd getXsd() {
        return xsd;
    }

    public void setXsd(Xsd xsd) {
        this.xsd = xsd;
    }

    public Sjzdz getKxsy() {
        return kxsy;
    }

    public void setKxsy(Sjzdz kxsy) {
        this.kxsy = kxsy;
    }

    public Double getYe() {
        return ye;
    }

    public void setYe(Double ye) {
        this.ye = ye;
    }

    public List<Pj> getYspjList() {
        return yspjList;
    }

    public void setYspjList(List<Pj> yspjList) {
        this.yspjList = yspjList;
    }

    public Sjzdz getFkfs() {
        return fkfs;
    }

    public void setFkfs(Sjzdz fkfs) {
        this.fkfs = fkfs;
    }

    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    public Date getEndDate() {
        return endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    public Date getKhfksj() {
        return khfksj;
    }

    public void setKhfksj(Date khfksj) {
        this.khfksj = khfksj;
    }

    public Integer getMxts() {
        return mxts;
    }

    public void setMxts(Integer mxts) {
        this.mxts = mxts;
    }

    public Double getTxl() {
        return txl;
    }

    public void setTxl(Double txl) {
        this.txl = txl;
    }

    public Double getTx() {
        return tx;
    }

    public void setTx(Double tx) {
        this.tx = tx;
    }

    public Date getShrq() {
        return shrq;
    }

    public void setShrq(Date shrq) {
        this.shrq = shrq;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Integer getSfklx() {
        return sfklx;
    }

    public Date getSfkrq() {
        return sfkrq;
    }

    public void setSfkrq(Date sfkrq) {
        this.sfkrq = sfkrq;
    }

    public Sjzdz getPjlx() {
        return pjlx;
    }

    public void setPjlx(Sjzdz pjlx) {
        this.pjlx = pjlx;
    }

    public void setSfklx(Integer sfklx) {
        this.sfklx = sfklx;
    }

    public Sjzdz getKxyt() {
        return kxyt;
    }

    public void setKxyt(Sjzdz kxyt) {
        this.kxyt = kxyt;
    }

    public Gsjg getGldw() {
        return gldw;
    }

    public void setGldw(Gsjg gldw) {
        this.gldw = gldw;
    }

    public Sjzdz getHklx() {
        return hklx;
    }

    public void setHklx(Sjzdz hklx) {
        this.hklx = hklx;
    }

    public Ht getHt() {
        return ht;
    }

    public void setHt(Ht ht) {
        this.ht = ht;
    }

    public Integer getKxlx() {
        return kxlx;
    }

    public void setKxlx(Integer kxlx) {
        this.kxlx = kxlx;
    }

    public String getZt() {
        return zt;
    }

    public void setZt(String zt) {
        this.zt = zt;
    }

    public Double getSfje() {
        return sfje;
    }

    public void setSfje(Double sfje) {
        this.sfje = sfje;
    }

    public String getBz() {
        return bz;
    }

    public void setBz(String bz) {
        this.bz = bz;
    }

    public Gsjg getSbgs() {
        return sbgs;
    }

    public void setSbgs(Gsjg sbgs) {
        this.sbgs = sbgs;
    }

    public Nbbm getSbbm() {
        return sbbm;
    }

    public void setSbbm(Nbbm sbbm) {
        this.sbbm = sbbm;
    }

    public Nbgs getKhgs() {
        return khgs;
    }

    public void setKhgs(Nbgs khgs) {
        this.khgs = khgs;
    }

    public Nbbm getKhbm() {
        return khbm;
    }

    public void setKhbm(Nbbm khbm) {
        this.khbm = khbm;
    }

    public Yg getSbr() {
        return sbr;
    }

    public void setSbr(Yg sbr) {
        this.sbr = sbr;
    }

    public String getBm() {
        return bm;
    }

    public void setBm(String bm) {
        this.bm = bm;
    }

    public Khh getGlkhh() {
        return glkhh;
    }

    public void setGlkhh(Khh glkhh) {
        this.glkhh = glkhh;
    }

    public Yg getShr() {
        return shr;
    }

    public void setShr(Yg shr) {
        this.shr = shr;
    }

    public List<Pj> getPjList() {
        return pjList;
    }

    public void setPjList(List<Pj> pjList) {
        this.pjList = pjList;
    }

    public List<Sfkmx> getSfkmxList() {
        return sfkmxList;
    }

    public void setSfkmxList(List<Sfkmx> sfkmxList) {
        this.sfkmxList = sfkmxList;
    }


    public Integer getAcctyear() {
        return acctyear;
    }

    public void setAcctyear(Integer acctyear) {
        this.acctyear = acctyear;
    }

    public String getUuid() {
        return uuid;
    }

    public void setUuid(String uuid) {
        this.uuid = uuid;
    }

    public String getVoucherId() {
        return voucherId;
    }

    public void setVoucherId(String voucherId) {
        this.voucherId = voucherId;
    }

    public Integer getVoucherNum() {
        return voucherNum;
    }

    public void setVoucherNum(Integer voucherNum) {
        this.voucherNum = voucherNum;
    }

    public Integer getInsertFlag() {
        return insertFlag;
    }

    public void setInsertFlag(Integer insertFlag) {
        this.insertFlag = insertFlag;
    }

    public Integer getDeleteFlag() {
        return deleteFlag;
    }

    public void setDeleteFlag(Integer deleteFlag) {
        this.deleteFlag = deleteFlag;
    }

    public List<Xyz> getXyzList() {
        return xyzList;
    }

    public void setXyzList(List<Xyz> xyzList) {
        this.xyzList = xyzList;
    }

    public String getCzzt() {
        return czzt;
    }

    public void setCzzt(String czzt) {
        this.czzt = czzt;
    }

    public String getSftpfy() {
        return sftpfy;
    }

    public void setSftpfy(String sftpfy) {
        this.sftpfy = sftpfy;
    }

    public Integer getSfwsyfk() {
        return sfwsyfk;
    }

    public void setSfwsyfk(Integer sfwsyfk) {
        this.sfwsyfk = sfwsyfk;
    }

    public Khh getNbkhh() {
        return nbkhh;
    }

    public void setNbkhh(Khh nbkhh) {
        this.nbkhh = nbkhh;
    }

    public String getCsh() {
        return csh;
    }

    public void setCsh(String csh) {
        this.csh = csh;
    }

    public String getProcessInstanceId() {
        return processInstanceId;
    }

    public void setProcessInstanceId(String processInstanceId) {
        this.processInstanceId = processInstanceId;
    }

    public Integer getQtfk() {
        return qtfk;
    }

    public void setQtfk(Integer qtfk) {
        this.qtfk = qtfk;
    }

    public Integer getZdhz() {
        return zdhz;
    }

    public void setZdhz(Integer zdhz) {
        this.zdhz = zdhz;
    }

    public List<Sfk> getNbhzSfkList() {
        return nbhzSfkList;
    }

    public void setNbhzSfkList(List<Sfk> nbhzSfkList) {
        this.nbhzSfkList = nbhzSfkList;
    }

    public Sfk getNbhzsfk() {
        return nbhzsfk;
    }

    public void setNbhzsfk(Sfk nbhzsfk) {
        this.nbhzsfk = nbhzsfk;
    }

    public Ejzh getJfejzh() {
        return jfejzh;
    }

    public void setJfejzh(Ejzh jfejzh) {
        this.jfejzh = jfejzh;
    }

    public Ejzh getDfejzh() {
        return dfejzh;
    }

    public void setDfejzh(Ejzh dfejzh) {
        this.dfejzh = dfejzh;
    }

    public Integer getWlzlx() {
        return wlzlx;
    }

    public void setWlzlx(Integer wlzlx) {
        this.wlzlx = wlzlx;
    }

    public Date getDrrq() {
        return drrq;
    }

    public void setDrrq(Date drrq) {
        this.drrq = drrq;
    }

    public Integer getSfBzj() {
        return sfBzj;
    }

    public void setSfBzj(Integer sfBzj) {
        this.sfBzj = sfBzj;
    }

    public String getPjhm() {
        return pjhm;
    }

    public void setPjhm(String pjhm) {
        this.pjhm = pjhm;
    }

    public String getSfhz() {
        return sfhz;
    }

    public void setSfhz(String sfhz) {
        this.sfhz = sfhz;
    }

    public Integer getSfpz() {
        return sfpz;
    }

    public void setSfpz(Integer sfpz) {
        this.sfpz = sfpz;
    }

    public Date getHzsj() {
        return hzsj;
    }

    public void setHzsj(Date hzsj) {
        this.hzsj = hzsj;
    }

    public Yg getHzr() {
        return hzr;
    }

    public void setHzr(Yg hzr) {
        this.hzr = hzr;
    }

    public Yg getRzr() {
        return rzr;
    }

    public void setRzr(Yg rzr) {
        this.rzr = rzr;
    }

    public String getSfjstx() {
        return sfjstx;
    }

    public Long getJstx() {
        return jstx;
    }

    public void setJstx(Long jstx) {
        this.jstx = jstx;
    }

    public void setSfjstx(String sfjstx) {
        this.sfjstx = sfjstx;
    }

    public Double getTxye() {
        return txye;
    }

    public void setTxye(Double txye) {
        this.txye = txye;
    }

    public Jsd getJsd() {
        return jsd;
    }

    public void setJsd(Jsd jsd) {
        this.jsd = jsd;
    }
}
